{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "a215ce2e",
   "metadata": {},
   "source": [
    "# 本周知识点\n",
    "〉1."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bcee9c64",
   "metadata": {},
   "source": [
    "## 2.条件变量\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c78a3c7f",
   "metadata": {},
   "source": [
    "* "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "e1ba0b22",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on module datetime:\n",
      "\n",
      "NAME\n",
      "    datetime - Fast implementation of the datetime type.\n",
      "\n",
      "MODULE REFERENCE\n",
      "    https://docs.python.org/3.9/library/datetime\n",
      "    \n",
      "    The following documentation is automatically generated from the Python\n",
      "    source files.  It may be incomplete, incorrect or include features that\n",
      "    are considered implementation detail and may vary between Python\n",
      "    implementations.  When in doubt, consult the module reference at the\n",
      "    location listed above.\n",
      "\n",
      "CLASSES\n",
      "    builtins.object\n",
      "        date\n",
      "            datetime\n",
      "        time\n",
      "        timedelta\n",
      "        tzinfo\n",
      "            timezone\n",
      "    \n",
      "    class date(builtins.object)\n",
      "     |  date(year, month, day) --> date object\n",
      "     |  \n",
      "     |  Methods defined here:\n",
      "     |  \n",
      "     |  __add__(self, value, /)\n",
      "     |      Return self+value.\n",
      "     |  \n",
      "     |  __eq__(self, value, /)\n",
      "     |      Return self==value.\n",
      "     |  \n",
      "     |  __format__(...)\n",
      "     |      Formats self with strftime.\n",
      "     |  \n",
      "     |  __ge__(self, value, /)\n",
      "     |      Return self>=value.\n",
      "     |  \n",
      "     |  __getattribute__(self, name, /)\n",
      "     |      Return getattr(self, name).\n",
      "     |  \n",
      "     |  __gt__(self, value, /)\n",
      "     |      Return self>value.\n",
      "     |  \n",
      "     |  __hash__(self, /)\n",
      "     |      Return hash(self).\n",
      "     |  \n",
      "     |  __le__(self, value, /)\n",
      "     |      Return self<=value.\n",
      "     |  \n",
      "     |  __lt__(self, value, /)\n",
      "     |      Return self<value.\n",
      "     |  \n",
      "     |  __ne__(self, value, /)\n",
      "     |      Return self!=value.\n",
      "     |  \n",
      "     |  __radd__(self, value, /)\n",
      "     |      Return value+self.\n",
      "     |  \n",
      "     |  __reduce__(...)\n",
      "     |      __reduce__() -> (cls, state)\n",
      "     |  \n",
      "     |  __repr__(self, /)\n",
      "     |      Return repr(self).\n",
      "     |  \n",
      "     |  __rsub__(self, value, /)\n",
      "     |      Return value-self.\n",
      "     |  \n",
      "     |  __str__(self, /)\n",
      "     |      Return str(self).\n",
      "     |  \n",
      "     |  __sub__(self, value, /)\n",
      "     |      Return self-value.\n",
      "     |  \n",
      "     |  ctime(...)\n",
      "     |      Return ctime() style string.\n",
      "     |  \n",
      "     |  isocalendar(...)\n",
      "     |      Return a named tuple containing ISO year, week number, and weekday.\n",
      "     |  \n",
      "     |  isoformat(...)\n",
      "     |      Return string in ISO 8601 format, YYYY-MM-DD.\n",
      "     |  \n",
      "     |  isoweekday(...)\n",
      "     |      Return the day of the week represented by the date.\n",
      "     |      Monday == 1 ... Sunday == 7\n",
      "     |  \n",
      "     |  replace(...)\n",
      "     |      Return date with new specified fields.\n",
      "     |  \n",
      "     |  strftime(...)\n",
      "     |      format -> strftime() style string.\n",
      "     |  \n",
      "     |  timetuple(...)\n",
      "     |      Return time tuple, compatible with time.localtime().\n",
      "     |  \n",
      "     |  toordinal(...)\n",
      "     |      Return proleptic Gregorian ordinal.  January 1 of year 1 is day 1.\n",
      "     |  \n",
      "     |  weekday(...)\n",
      "     |      Return the day of the week represented by the date.\n",
      "     |      Monday == 0 ... Sunday == 6\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Class methods defined here:\n",
      "     |  \n",
      "     |  fromisocalendar(...) from builtins.type\n",
      "     |      int, int, int -> Construct a date from the ISO year, week number and weekday.\n",
      "     |      \n",
      "     |      This is the inverse of the date.isocalendar() function\n",
      "     |  \n",
      "     |  fromisoformat(...) from builtins.type\n",
      "     |      str -> Construct a date from the output of date.isoformat()\n",
      "     |  \n",
      "     |  fromordinal(...) from builtins.type\n",
      "     |      int -> date corresponding to a proleptic Gregorian ordinal.\n",
      "     |  \n",
      "     |  fromtimestamp(timestamp, /) from builtins.type\n",
      "     |      Create a date from a POSIX timestamp.\n",
      "     |      \n",
      "     |      The timestamp is a number, e.g. created via time.time(), that is interpreted\n",
      "     |      as local time.\n",
      "     |  \n",
      "     |  today(...) from builtins.type\n",
      "     |      Current date or datetime:  same as self.__class__.fromtimestamp(time.time()).\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Static methods defined here:\n",
      "     |  \n",
      "     |  __new__(*args, **kwargs) from builtins.type\n",
      "     |      Create and return a new object.  See help(type) for accurate signature.\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Data descriptors defined here:\n",
      "     |  \n",
      "     |  day\n",
      "     |  \n",
      "     |  month\n",
      "     |  \n",
      "     |  year\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Data and other attributes defined here:\n",
      "     |  \n",
      "     |  max = datetime.date(9999, 12, 31)\n",
      "     |  \n",
      "     |  min = datetime.date(1, 1, 1)\n",
      "     |  \n",
      "     |  resolution = datetime.timedelta(days=1)\n",
      "    \n",
      "    class datetime(date)\n",
      "     |  datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]])\n",
      "     |  \n",
      "     |  The year, month and day arguments are required. tzinfo may be None, or an\n",
      "     |  instance of a tzinfo subclass. The remaining arguments may be ints.\n",
      "     |  \n",
      "     |  Method resolution order:\n",
      "     |      datetime\n",
      "     |      date\n",
      "     |      builtins.object\n",
      "     |  \n",
      "     |  Methods defined here:\n",
      "     |  \n",
      "     |  __add__(self, value, /)\n",
      "     |      Return self+value.\n",
      "     |  \n",
      "     |  __eq__(self, value, /)\n",
      "     |      Return self==value.\n",
      "     |  \n",
      "     |  __ge__(self, value, /)\n",
      "     |      Return self>=value.\n",
      "     |  \n",
      "     |  __getattribute__(self, name, /)\n",
      "     |      Return getattr(self, name).\n",
      "     |  \n",
      "     |  __gt__(self, value, /)\n",
      "     |      Return self>value.\n",
      "     |  \n",
      "     |  __hash__(self, /)\n",
      "     |      Return hash(self).\n",
      "     |  \n",
      "     |  __le__(self, value, /)\n",
      "     |      Return self<=value.\n",
      "     |  \n",
      "     |  __lt__(self, value, /)\n",
      "     |      Return self<value.\n",
      "     |  \n",
      "     |  __ne__(self, value, /)\n",
      "     |      Return self!=value.\n",
      "     |  \n",
      "     |  __radd__(self, value, /)\n",
      "     |      Return value+self.\n",
      "     |  \n",
      "     |  __reduce__(...)\n",
      "     |      __reduce__() -> (cls, state)\n",
      "     |  \n",
      "     |  __reduce_ex__(...)\n",
      "     |      __reduce_ex__(proto) -> (cls, state)\n",
      "     |  \n",
      "     |  __repr__(self, /)\n",
      "     |      Return repr(self).\n",
      "     |  \n",
      "     |  __rsub__(self, value, /)\n",
      "     |      Return value-self.\n",
      "     |  \n",
      "     |  __str__(self, /)\n",
      "     |      Return str(self).\n",
      "     |  \n",
      "     |  __sub__(self, value, /)\n",
      "     |      Return self-value.\n",
      "     |  \n",
      "     |  astimezone(...)\n",
      "     |      tz -> convert to local time in new timezone tz\n",
      "     |  \n",
      "     |  ctime(...)\n",
      "     |      Return ctime() style string.\n",
      "     |  \n",
      "     |  date(...)\n",
      "     |      Return date object with same year, month and day.\n",
      "     |  \n",
      "     |  dst(...)\n",
      "     |      Return self.tzinfo.dst(self).\n",
      "     |  \n",
      "     |  isoformat(...)\n",
      "     |      [sep] -> string in ISO 8601 format, YYYY-MM-DDT[HH[:MM[:SS[.mmm[uuu]]]]][+HH:MM].\n",
      "     |      sep is used to separate the year from the time, and defaults to 'T'.\n",
      "     |      The optional argument timespec specifies the number of additional terms\n",
      "     |      of the time to include. Valid options are 'auto', 'hours', 'minutes',\n",
      "     |      'seconds', 'milliseconds' and 'microseconds'.\n",
      "     |  \n",
      "     |  replace(...)\n",
      "     |      Return datetime with new specified fields.\n",
      "     |  \n",
      "     |  time(...)\n",
      "     |      Return time object with same time but with tzinfo=None.\n",
      "     |  \n",
      "     |  timestamp(...)\n",
      "     |      Return POSIX timestamp as float.\n",
      "     |  \n",
      "     |  timetuple(...)\n",
      "     |      Return time tuple, compatible with time.localtime().\n",
      "     |  \n",
      "     |  timetz(...)\n",
      "     |      Return time object with same time and tzinfo.\n",
      "     |  \n",
      "     |  tzname(...)\n",
      "     |      Return self.tzinfo.tzname(self).\n",
      "     |  \n",
      "     |  utcoffset(...)\n",
      "     |      Return self.tzinfo.utcoffset(self).\n",
      "     |  \n",
      "     |  utctimetuple(...)\n",
      "     |      Return UTC time tuple, compatible with time.localtime().\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Class methods defined here:\n",
      "     |  \n",
      "     |  combine(...) from builtins.type\n",
      "     |      date, time -> datetime with same date and time fields\n",
      "     |  \n",
      "     |  fromisoformat(...) from builtins.type\n",
      "     |      string -> datetime from datetime.isoformat() output\n",
      "     |  \n",
      "     |  fromtimestamp(...) from builtins.type\n",
      "     |      timestamp[, tz] -> tz's local time from POSIX timestamp.\n",
      "     |  \n",
      "     |  now(tz=None) from builtins.type\n",
      "     |      Returns new datetime object representing current time local to tz.\n",
      "     |      \n",
      "     |        tz\n",
      "     |          Timezone object.\n",
      "     |      \n",
      "     |      If no tz is specified, uses local timezone.\n",
      "     |  \n",
      "     |  strptime(...) from builtins.type\n",
      "     |      string, format -> new datetime parsed from a string (like time.strptime()).\n",
      "     |  \n",
      "     |  utcfromtimestamp(...) from builtins.type\n",
      "     |      Construct a naive UTC datetime from a POSIX timestamp.\n",
      "     |  \n",
      "     |  utcnow(...) from builtins.type\n",
      "     |      Return a new datetime representing UTC day and time.\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Static methods defined here:\n",
      "     |  \n",
      "     |  __new__(*args, **kwargs) from builtins.type\n",
      "     |      Create and return a new object.  See help(type) for accurate signature.\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Data descriptors defined here:\n",
      "     |  \n",
      "     |  fold\n",
      "     |  \n",
      "     |  hour\n",
      "     |  \n",
      "     |  microsecond\n",
      "     |  \n",
      "     |  minute\n",
      "     |  \n",
      "     |  second\n",
      "     |  \n",
      "     |  tzinfo\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Data and other attributes defined here:\n",
      "     |  \n",
      "     |  max = datetime.datetime(9999, 12, 31, 23, 59, 59, 999999)\n",
      "     |  \n",
      "     |  min = datetime.datetime(1, 1, 1, 0, 0)\n",
      "     |  \n",
      "     |  resolution = datetime.timedelta(microseconds=1)\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Methods inherited from date:\n",
      "     |  \n",
      "     |  __format__(...)\n",
      "     |      Formats self with strftime.\n",
      "     |  \n",
      "     |  isocalendar(...)\n",
      "     |      Return a named tuple containing ISO year, week number, and weekday.\n",
      "     |  \n",
      "     |  isoweekday(...)\n",
      "     |      Return the day of the week represented by the date.\n",
      "     |      Monday == 1 ... Sunday == 7\n",
      "     |  \n",
      "     |  strftime(...)\n",
      "     |      format -> strftime() style string.\n",
      "     |  \n",
      "     |  toordinal(...)\n",
      "     |      Return proleptic Gregorian ordinal.  January 1 of year 1 is day 1.\n",
      "     |  \n",
      "     |  weekday(...)\n",
      "     |      Return the day of the week represented by the date.\n",
      "     |      Monday == 0 ... Sunday == 6\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Class methods inherited from date:\n",
      "     |  \n",
      "     |  fromisocalendar(...) from builtins.type\n",
      "     |      int, int, int -> Construct a date from the ISO year, week number and weekday.\n",
      "     |      \n",
      "     |      This is the inverse of the date.isocalendar() function\n",
      "     |  \n",
      "     |  fromordinal(...) from builtins.type\n",
      "     |      int -> date corresponding to a proleptic Gregorian ordinal.\n",
      "     |  \n",
      "     |  today(...) from builtins.type\n",
      "     |      Current date or datetime:  same as self.__class__.fromtimestamp(time.time()).\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Data descriptors inherited from date:\n",
      "     |  \n",
      "     |  day\n",
      "     |  \n",
      "     |  month\n",
      "     |  \n",
      "     |  year\n",
      "    \n",
      "    class time(builtins.object)\n",
      "     |  time([hour[, minute[, second[, microsecond[, tzinfo]]]]]) --> a time object\n",
      "     |  \n",
      "     |  All arguments are optional. tzinfo may be None, or an instance of\n",
      "     |  a tzinfo subclass. The remaining arguments may be ints.\n",
      "     |  \n",
      "     |  Methods defined here:\n",
      "     |  \n",
      "     |  __eq__(self, value, /)\n",
      "     |      Return self==value.\n",
      "     |  \n",
      "     |  __format__(...)\n",
      "     |      Formats self with strftime.\n",
      "     |  \n",
      "     |  __ge__(self, value, /)\n",
      "     |      Return self>=value.\n",
      "     |  \n",
      "     |  __getattribute__(self, name, /)\n",
      "     |      Return getattr(self, name).\n",
      "     |  \n",
      "     |  __gt__(self, value, /)\n",
      "     |      Return self>value.\n",
      "     |  \n",
      "     |  __hash__(self, /)\n",
      "     |      Return hash(self).\n",
      "     |  \n",
      "     |  __le__(self, value, /)\n",
      "     |      Return self<=value.\n",
      "     |  \n",
      "     |  __lt__(self, value, /)\n",
      "     |      Return self<value.\n",
      "     |  \n",
      "     |  __ne__(self, value, /)\n",
      "     |      Return self!=value.\n",
      "     |  \n",
      "     |  __reduce__(...)\n",
      "     |      __reduce__() -> (cls, state)\n",
      "     |  \n",
      "     |  __reduce_ex__(...)\n",
      "     |      __reduce_ex__(proto) -> (cls, state)\n",
      "     |  \n",
      "     |  __repr__(self, /)\n",
      "     |      Return repr(self).\n",
      "     |  \n",
      "     |  __str__(self, /)\n",
      "     |      Return str(self).\n",
      "     |  \n",
      "     |  dst(...)\n",
      "     |      Return self.tzinfo.dst(self).\n",
      "     |  \n",
      "     |  isoformat(...)\n",
      "     |      Return string in ISO 8601 format, [HH[:MM[:SS[.mmm[uuu]]]]][+HH:MM].\n",
      "     |      \n",
      "     |      The optional argument timespec specifies the number of additional terms\n",
      "     |      of the time to include. Valid options are 'auto', 'hours', 'minutes',\n",
      "     |      'seconds', 'milliseconds' and 'microseconds'.\n",
      "     |  \n",
      "     |  replace(...)\n",
      "     |      Return time with new specified fields.\n",
      "     |  \n",
      "     |  strftime(...)\n",
      "     |      format -> strftime() style string.\n",
      "     |  \n",
      "     |  tzname(...)\n",
      "     |      Return self.tzinfo.tzname(self).\n",
      "     |  \n",
      "     |  utcoffset(...)\n",
      "     |      Return self.tzinfo.utcoffset(self).\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Class methods defined here:\n",
      "     |  \n",
      "     |  fromisoformat(...) from builtins.type\n",
      "     |      string -> time from time.isoformat() output\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Static methods defined here:\n",
      "     |  \n",
      "     |  __new__(*args, **kwargs) from builtins.type\n",
      "     |      Create and return a new object.  See help(type) for accurate signature.\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Data descriptors defined here:\n",
      "     |  \n",
      "     |  fold\n",
      "     |  \n",
      "     |  hour\n",
      "     |  \n",
      "     |  microsecond\n",
      "     |  \n",
      "     |  minute\n",
      "     |  \n",
      "     |  second\n",
      "     |  \n",
      "     |  tzinfo\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Data and other attributes defined here:\n",
      "     |  \n",
      "     |  max = datetime.time(23, 59, 59, 999999)\n",
      "     |  \n",
      "     |  min = datetime.time(0, 0)\n",
      "     |  \n",
      "     |  resolution = datetime.timedelta(microseconds=1)\n",
      "    \n",
      "    class timedelta(builtins.object)\n",
      "     |  Difference between two datetime values.\n",
      "     |  \n",
      "     |  timedelta(days=0, seconds=0, microseconds=0, milliseconds=0, minutes=0, hours=0, weeks=0)\n",
      "     |  \n",
      "     |  All arguments are optional and default to 0.\n",
      "     |  Arguments may be integers or floats, and may be positive or negative.\n",
      "     |  \n",
      "     |  Methods defined here:\n",
      "     |  \n",
      "     |  __abs__(self, /)\n",
      "     |      abs(self)\n",
      "     |  \n",
      "     |  __add__(self, value, /)\n",
      "     |      Return self+value.\n",
      "     |  \n",
      "     |  __bool__(self, /)\n",
      "     |      True if self else False\n",
      "     |  \n",
      "     |  __divmod__(self, value, /)\n",
      "     |      Return divmod(self, value).\n",
      "     |  \n",
      "     |  __eq__(self, value, /)\n",
      "     |      Return self==value.\n",
      "     |  \n",
      "     |  __floordiv__(self, value, /)\n",
      "     |      Return self//value.\n",
      "     |  \n",
      "     |  __ge__(self, value, /)\n",
      "     |      Return self>=value.\n",
      "     |  \n",
      "     |  __getattribute__(self, name, /)\n",
      "     |      Return getattr(self, name).\n",
      "     |  \n",
      "     |  __gt__(self, value, /)\n",
      "     |      Return self>value.\n",
      "     |  \n",
      "     |  __hash__(self, /)\n",
      "     |      Return hash(self).\n",
      "     |  \n",
      "     |  __le__(self, value, /)\n",
      "     |      Return self<=value.\n",
      "     |  \n",
      "     |  __lt__(self, value, /)\n",
      "     |      Return self<value.\n",
      "     |  \n",
      "     |  __mod__(self, value, /)\n",
      "     |      Return self%value.\n",
      "     |  \n",
      "     |  __mul__(self, value, /)\n",
      "     |      Return self*value.\n",
      "     |  \n",
      "     |  __ne__(self, value, /)\n",
      "     |      Return self!=value.\n",
      "     |  \n",
      "     |  __neg__(self, /)\n",
      "     |      -self\n",
      "     |  \n",
      "     |  __pos__(self, /)\n",
      "     |      +self\n",
      "     |  \n",
      "     |  __radd__(self, value, /)\n",
      "     |      Return value+self.\n",
      "     |  \n",
      "     |  __rdivmod__(self, value, /)\n",
      "     |      Return divmod(value, self).\n",
      "     |  \n",
      "     |  __reduce__(...)\n",
      "     |      __reduce__() -> (cls, state)\n",
      "     |  \n",
      "     |  __repr__(self, /)\n",
      "     |      Return repr(self).\n",
      "     |  \n",
      "     |  __rfloordiv__(self, value, /)\n",
      "     |      Return value//self.\n",
      "     |  \n",
      "     |  __rmod__(self, value, /)\n",
      "     |      Return value%self.\n",
      "     |  \n",
      "     |  __rmul__(self, value, /)\n",
      "     |      Return value*self.\n",
      "     |  \n",
      "     |  __rsub__(self, value, /)\n",
      "     |      Return value-self.\n",
      "     |  \n",
      "     |  __rtruediv__(self, value, /)\n",
      "     |      Return value/self.\n",
      "     |  \n",
      "     |  __str__(self, /)\n",
      "     |      Return str(self).\n",
      "     |  \n",
      "     |  __sub__(self, value, /)\n",
      "     |      Return self-value.\n",
      "     |  \n",
      "     |  __truediv__(self, value, /)\n",
      "     |      Return self/value.\n",
      "     |  \n",
      "     |  total_seconds(...)\n",
      "     |      Total seconds in the duration.\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Static methods defined here:\n",
      "     |  \n",
      "     |  __new__(*args, **kwargs) from builtins.type\n",
      "     |      Create and return a new object.  See help(type) for accurate signature.\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Data descriptors defined here:\n",
      "     |  \n",
      "     |  days\n",
      "     |      Number of days.\n",
      "     |  \n",
      "     |  microseconds\n",
      "     |      Number of microseconds (>= 0 and less than 1 second).\n",
      "     |  \n",
      "     |  seconds\n",
      "     |      Number of seconds (>= 0 and less than 1 day).\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Data and other attributes defined here:\n",
      "     |  \n",
      "     |  max = datetime.timedelta(days=999999999, seconds=86399, microseconds=9...\n",
      "     |  \n",
      "     |  min = datetime.timedelta(days=-999999999)\n",
      "     |  \n",
      "     |  resolution = datetime.timedelta(microseconds=1)\n",
      "    \n",
      "    class timezone(tzinfo)\n",
      "     |  Fixed offset from UTC implementation of tzinfo.\n",
      "     |  \n",
      "     |  Method resolution order:\n",
      "     |      timezone\n",
      "     |      tzinfo\n",
      "     |      builtins.object\n",
      "     |  \n",
      "     |  Methods defined here:\n",
      "     |  \n",
      "     |  __eq__(self, value, /)\n",
      "     |      Return self==value.\n",
      "     |  \n",
      "     |  __ge__(self, value, /)\n",
      "     |      Return self>=value.\n",
      "     |  \n",
      "     |  __getinitargs__(...)\n",
      "     |      pickle support\n",
      "     |  \n",
      "     |  __gt__(self, value, /)\n",
      "     |      Return self>value.\n",
      "     |  \n",
      "     |  __hash__(self, /)\n",
      "     |      Return hash(self).\n",
      "     |  \n",
      "     |  __le__(self, value, /)\n",
      "     |      Return self<=value.\n",
      "     |  \n",
      "     |  __lt__(self, value, /)\n",
      "     |      Return self<value.\n",
      "     |  \n",
      "     |  __ne__(self, value, /)\n",
      "     |      Return self!=value.\n",
      "     |  \n",
      "     |  __repr__(self, /)\n",
      "     |      Return repr(self).\n",
      "     |  \n",
      "     |  __str__(self, /)\n",
      "     |      Return str(self).\n",
      "     |  \n",
      "     |  dst(...)\n",
      "     |      Return None.\n",
      "     |  \n",
      "     |  fromutc(...)\n",
      "     |      datetime in UTC -> datetime in local time.\n",
      "     |  \n",
      "     |  tzname(...)\n",
      "     |      If name is specified when timezone is created, returns the name.  Otherwise returns offset as 'UTC(+|-)HH:MM'.\n",
      "     |  \n",
      "     |  utcoffset(...)\n",
      "     |      Return fixed offset.\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Static methods defined here:\n",
      "     |  \n",
      "     |  __new__(*args, **kwargs) from builtins.type\n",
      "     |      Create and return a new object.  See help(type) for accurate signature.\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Data and other attributes defined here:\n",
      "     |  \n",
      "     |  max = datetime.timezone(datetime.timedelta(seconds=86340))\n",
      "     |  \n",
      "     |  min = datetime.timezone(datetime.timedelta(days=-1, seconds=60))\n",
      "     |  \n",
      "     |  utc = datetime.timezone.utc\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Methods inherited from tzinfo:\n",
      "     |  \n",
      "     |  __getattribute__(self, name, /)\n",
      "     |      Return getattr(self, name).\n",
      "     |  \n",
      "     |  __reduce__(...)\n",
      "     |      -> (cls, state)\n",
      "    \n",
      "    class tzinfo(builtins.object)\n",
      "     |  Abstract base class for time zone info objects.\n",
      "     |  \n",
      "     |  Methods defined here:\n",
      "     |  \n",
      "     |  __getattribute__(self, name, /)\n",
      "     |      Return getattr(self, name).\n",
      "     |  \n",
      "     |  __reduce__(...)\n",
      "     |      -> (cls, state)\n",
      "     |  \n",
      "     |  dst(...)\n",
      "     |      datetime -> DST offset as timedelta positive east of UTC.\n",
      "     |  \n",
      "     |  fromutc(...)\n",
      "     |      datetime in UTC -> datetime in local time.\n",
      "     |  \n",
      "     |  tzname(...)\n",
      "     |      datetime -> string name of time zone.\n",
      "     |  \n",
      "     |  utcoffset(...)\n",
      "     |      datetime -> timedelta showing offset from UTC, negative values indicating West of UTC\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Static methods defined here:\n",
      "     |  \n",
      "     |  __new__(*args, **kwargs) from builtins.type\n",
      "     |      Create and return a new object.  See help(type) for accurate signature.\n",
      "\n",
      "DATA\n",
      "    MAXYEAR = 9999\n",
      "    MINYEAR = 1\n",
      "    __all__ = ('date', 'datetime', 'time', 'timedelta', 'timezone', 'tzinf...\n",
      "\n",
      "FILE\n",
      "    /Users/ZhangBaoZhe/opt/anaconda3/lib/python3.9/datetime.py\n",
      "\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help (\"datetime\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "e933d1ae",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "datetime.date(2022, 9, 6)"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import datetime\n",
    "datetime.date.today()\n",
    "#datetime可以获取到年月日，但好像不能获取到周几..."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "896e7f78",
   "metadata": {},
   "outputs": [],
   "source": [
    "#创建today变量（模块获取今天的星期几？）\n",
    "#知识点： 1. 先创建变量，才能进行判断\n",
    "#        2. if语句 观察条件判断模块\n",
    "\n",
    "if today ==\"saturday\":\n",
    "    print(\"超开心\")\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e923114e",
   "metadata": {},
   "source": [
    "·判断当前是一周中的星期几，"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "32194442",
   "metadata": {},
   "outputs": [],
   "source": [
    "#wkday=0,1,2,3,4,5,6  分别指周一到周日"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "79b04820",
   "metadata": {},
   "outputs": [],
   "source": [
    "if wday!=1:#判断是否是周二\n",
    "    print(\"今天没有Python课\")\n",
    "else：\n",
    "  if time"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e56fc603",
   "metadata": {},
   "source": [
    "4.foe循环和range方法"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "128e1252",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "802028a4",
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "invalid syntax (2530327299.py, line 1)",
     "output_type": "error",
     "traceback": [
      "\u001b[0;36m  Input \u001b[0;32mIn [7]\u001b[0;36m\u001b[0m\n\u001b[0;31m    1 for i in [1,2,3]\u001b[0m\n\u001b[0m      ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n"
     ]
    }
   ],
   "source": [
    "1 for i in [1,2,3]\n",
    "2     print(i)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "b8cbc864",
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "invalid syntax (1546748429.py, line 1)",
     "output_type": "error",
     "traceback": [
      "\u001b[0;36m  Input \u001b[0;32mIn [8]\u001b[0;36m\u001b[0m\n\u001b[0;31m    1.for ch in \"Hi!\"\u001b[0m\n\u001b[0m      ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n"
     ]
    }
   ],
   "source": [
    "1.for ch in \"Hi!\"\n",
    "2     print(ch)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "92948c7a",
   "metadata": {},
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "invalid syntax (2584981211.py, line 1)",
     "output_type": "error",
     "traceback": [
      "\u001b[0;36m  Input \u001b[0;32mIn [9]\u001b[0;36m\u001b[0m\n\u001b[0;31m    1.for num in  rang (5):\u001b[0m\n\u001b[0m      ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n"
     ]
    }
   ],
   "source": [
    "1.for num in  rang (5):\n",
    "2     print('Head First Rocks!')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d06605ef",
   "metadata": {},
   "outputs": [],
   "source": [
    "#range()自动生成险要的数值，可以控制for"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "6e351b8c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n",
      "3\n",
      "6\n",
      "9\n"
     ]
    }
   ],
   "source": [
    "#三个值，第三个值决定step步长\n",
    "for num in range(0,10,3):\n",
    "    print(num)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d097c650",
   "metadata": {},
   "outputs": [],
   "source": [
    "#for循环遍历案例 ： 某学校新闻网站数据URL队列获取\n",
    "\n",
    "#中大南方-招投标-"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b72525fe",
   "metadata": {},
   "source": [
    "5.Random模块"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "e0e460f1",
   "metadata": {},
   "outputs": [],
   "source": [
    "import random"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "30970100",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.4732234562878881"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#random.random方法:取（0，1）\n",
    "random.random()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "122f7954",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "3"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#random.randint(a,b),随机生成a-b之间的一个数值\n",
    "random.randint(1,6)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "60c5cb76",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "6\n",
      "6\n",
      "1\n",
      "5\n",
      "1\n"
     ]
    }
   ],
   "source": [
    "for i in range(5):\n",
    "    print(random.randint(1,6))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "148a74da",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "af998883",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on module random:\n",
      "\n",
      "NAME\n",
      "    random - Random variable generators.\n",
      "\n",
      "MODULE REFERENCE\n",
      "    https://docs.python.org/3.9/library/random\n",
      "    \n",
      "    The following documentation is automatically generated from the Python\n",
      "    source files.  It may be incomplete, incorrect or include features that\n",
      "    are considered implementation detail and may vary between Python\n",
      "    implementations.  When in doubt, consult the module reference at the\n",
      "    location listed above.\n",
      "\n",
      "DESCRIPTION\n",
      "        bytes\n",
      "        -----\n",
      "               uniform bytes (values between 0 and 255)\n",
      "    \n",
      "        integers\n",
      "        --------\n",
      "               uniform within range\n",
      "    \n",
      "        sequences\n",
      "        ---------\n",
      "               pick random element\n",
      "               pick random sample\n",
      "               pick weighted random sample\n",
      "               generate random permutation\n",
      "    \n",
      "        distributions on the real line:\n",
      "        ------------------------------\n",
      "               uniform\n",
      "               triangular\n",
      "               normal (Gaussian)\n",
      "               lognormal\n",
      "               negative exponential\n",
      "               gamma\n",
      "               beta\n",
      "               pareto\n",
      "               Weibull\n",
      "    \n",
      "        distributions on the circle (angles 0 to 2pi)\n",
      "        ---------------------------------------------\n",
      "               circular uniform\n",
      "               von Mises\n",
      "    \n",
      "    General notes on the underlying Mersenne Twister core generator:\n",
      "    \n",
      "    * The period is 2**19937-1.\n",
      "    * It is one of the most extensively tested generators in existence.\n",
      "    * The random() method is implemented in C, executes in a single Python step,\n",
      "      and is, therefore, threadsafe.\n",
      "\n",
      "CLASSES\n",
      "    _random.Random(builtins.object)\n",
      "        Random\n",
      "            SystemRandom\n",
      "    \n",
      "    class Random(_random.Random)\n",
      "     |  Random(x=None)\n",
      "     |  \n",
      "     |  Random number generator base class used by bound module functions.\n",
      "     |  \n",
      "     |  Used to instantiate instances of Random to get generators that don't\n",
      "     |  share state.\n",
      "     |  \n",
      "     |  Class Random can also be subclassed if you want to use a different basic\n",
      "     |  generator of your own devising: in that case, override the following\n",
      "     |  methods:  random(), seed(), getstate(), and setstate().\n",
      "     |  Optionally, implement a getrandbits() method so that randrange()\n",
      "     |  can cover arbitrarily large ranges.\n",
      "     |  \n",
      "     |  Method resolution order:\n",
      "     |      Random\n",
      "     |      _random.Random\n",
      "     |      builtins.object\n",
      "     |  \n",
      "     |  Methods defined here:\n",
      "     |  \n",
      "     |  __getstate__(self)\n",
      "     |      # Issue 17489: Since __reduce__ was defined to fix #759889 this is no\n",
      "     |      # longer called; we leave it here because it has been here since random was\n",
      "     |      # rewritten back in 2001 and why risk breaking something.\n",
      "     |  \n",
      "     |  __init__(self, x=None)\n",
      "     |      Initialize an instance.\n",
      "     |      \n",
      "     |      Optional argument x controls seeding, as for Random.seed().\n",
      "     |  \n",
      "     |  __reduce__(self)\n",
      "     |      Helper for pickle.\n",
      "     |  \n",
      "     |  __setstate__(self, state)\n",
      "     |  \n",
      "     |  betavariate(self, alpha, beta)\n",
      "     |      Beta distribution.\n",
      "     |      \n",
      "     |      Conditions on the parameters are alpha > 0 and beta > 0.\n",
      "     |      Returned values range between 0 and 1.\n",
      "     |  \n",
      "     |  choice(self, seq)\n",
      "     |      Choose a random element from a non-empty sequence.\n",
      "     |  \n",
      "     |  choices(self, population, weights=None, *, cum_weights=None, k=1)\n",
      "     |      Return a k sized list of population elements chosen with replacement.\n",
      "     |      \n",
      "     |      If the relative weights or cumulative weights are not specified,\n",
      "     |      the selections are made with equal probability.\n",
      "     |  \n",
      "     |  expovariate(self, lambd)\n",
      "     |      Exponential distribution.\n",
      "     |      \n",
      "     |      lambd is 1.0 divided by the desired mean.  It should be\n",
      "     |      nonzero.  (The parameter would be called \"lambda\", but that is\n",
      "     |      a reserved word in Python.)  Returned values range from 0 to\n",
      "     |      positive infinity if lambd is positive, and from negative\n",
      "     |      infinity to 0 if lambd is negative.\n",
      "     |  \n",
      "     |  gammavariate(self, alpha, beta)\n",
      "     |      Gamma distribution.  Not the gamma function!\n",
      "     |      \n",
      "     |      Conditions on the parameters are alpha > 0 and beta > 0.\n",
      "     |      \n",
      "     |      The probability distribution function is:\n",
      "     |      \n",
      "     |                  x ** (alpha - 1) * math.exp(-x / beta)\n",
      "     |        pdf(x) =  --------------------------------------\n",
      "     |                    math.gamma(alpha) * beta ** alpha\n",
      "     |  \n",
      "     |  gauss(self, mu, sigma)\n",
      "     |      Gaussian distribution.\n",
      "     |      \n",
      "     |      mu is the mean, and sigma is the standard deviation.  This is\n",
      "     |      slightly faster than the normalvariate() function.\n",
      "     |      \n",
      "     |      Not thread-safe without a lock around calls.\n",
      "     |  \n",
      "     |  getstate(self)\n",
      "     |      Return internal state; can be passed to setstate() later.\n",
      "     |  \n",
      "     |  lognormvariate(self, mu, sigma)\n",
      "     |      Log normal distribution.\n",
      "     |      \n",
      "     |      If you take the natural logarithm of this distribution, you'll get a\n",
      "     |      normal distribution with mean mu and standard deviation sigma.\n",
      "     |      mu can have any value, and sigma must be greater than zero.\n",
      "     |  \n",
      "     |  normalvariate(self, mu, sigma)\n",
      "     |      Normal distribution.\n",
      "     |      \n",
      "     |      mu is the mean, and sigma is the standard deviation.\n",
      "     |  \n",
      "     |  paretovariate(self, alpha)\n",
      "     |      Pareto distribution.  alpha is the shape parameter.\n",
      "     |  \n",
      "     |  randbytes(self, n)\n",
      "     |      Generate n random bytes.\n",
      "     |  \n",
      "     |  randint(self, a, b)\n",
      "     |      Return random integer in range [a, b], including both end points.\n",
      "     |  \n",
      "     |  randrange(self, start, stop=None, step=1)\n",
      "     |      Choose a random item from range(start, stop[, step]).\n",
      "     |      \n",
      "     |      This fixes the problem with randint() which includes the\n",
      "     |      endpoint; in Python this is usually not what you want.\n",
      "     |  \n",
      "     |  sample(self, population, k, *, counts=None)\n",
      "     |      Chooses k unique random elements from a population sequence or set.\n",
      "     |      \n",
      "     |      Returns a new list containing elements from the population while\n",
      "     |      leaving the original population unchanged.  The resulting list is\n",
      "     |      in selection order so that all sub-slices will also be valid random\n",
      "     |      samples.  This allows raffle winners (the sample) to be partitioned\n",
      "     |      into grand prize and second place winners (the subslices).\n",
      "     |      \n",
      "     |      Members of the population need not be hashable or unique.  If the\n",
      "     |      population contains repeats, then each occurrence is a possible\n",
      "     |      selection in the sample.\n",
      "     |      \n",
      "     |      Repeated elements can be specified one at a time or with the optional\n",
      "     |      counts parameter.  For example:\n",
      "     |      \n",
      "     |          sample(['red', 'blue'], counts=[4, 2], k=5)\n",
      "     |      \n",
      "     |      is equivalent to:\n",
      "     |      \n",
      "     |          sample(['red', 'red', 'red', 'red', 'blue', 'blue'], k=5)\n",
      "     |      \n",
      "     |      To choose a sample from a range of integers, use range() for the\n",
      "     |      population argument.  This is especially fast and space efficient\n",
      "     |      for sampling from a large population:\n",
      "     |      \n",
      "     |          sample(range(10000000), 60)\n",
      "     |  \n",
      "     |  seed(self, a=None, version=2)\n",
      "     |      Initialize internal state from a seed.\n",
      "     |      \n",
      "     |      The only supported seed types are None, int, float,\n",
      "     |      str, bytes, and bytearray.\n",
      "     |      \n",
      "     |      None or no argument seeds from current time or from an operating\n",
      "     |      system specific randomness source if available.\n",
      "     |      \n",
      "     |      If *a* is an int, all bits are used.\n",
      "     |      \n",
      "     |      For version 2 (the default), all of the bits are used if *a* is a str,\n",
      "     |      bytes, or bytearray.  For version 1 (provided for reproducing random\n",
      "     |      sequences from older versions of Python), the algorithm for str and\n",
      "     |      bytes generates a narrower range of seeds.\n",
      "     |  \n",
      "     |  setstate(self, state)\n",
      "     |      Restore internal state from object returned by getstate().\n",
      "     |  \n",
      "     |  shuffle(self, x, random=None)\n",
      "     |      Shuffle list x in place, and return None.\n",
      "     |      \n",
      "     |      Optional argument random is a 0-argument function returning a\n",
      "     |      random float in [0.0, 1.0); if it is the default None, the\n",
      "     |      standard random.random will be used.\n",
      "     |  \n",
      "     |  triangular(self, low=0.0, high=1.0, mode=None)\n",
      "     |      Triangular distribution.\n",
      "     |      \n",
      "     |      Continuous distribution bounded by given lower and upper limits,\n",
      "     |      and having a given mode value in-between.\n",
      "     |      \n",
      "     |      http://en.wikipedia.org/wiki/Triangular_distribution\n",
      "     |  \n",
      "     |  uniform(self, a, b)\n",
      "     |      Get a random number in the range [a, b) or [a, b] depending on rounding.\n",
      "     |  \n",
      "     |  vonmisesvariate(self, mu, kappa)\n",
      "     |      Circular data distribution.\n",
      "     |      \n",
      "     |      mu is the mean angle, expressed in radians between 0 and 2*pi, and\n",
      "     |      kappa is the concentration parameter, which must be greater than or\n",
      "     |      equal to zero.  If kappa is equal to zero, this distribution reduces\n",
      "     |      to a uniform random angle over the range 0 to 2*pi.\n",
      "     |  \n",
      "     |  weibullvariate(self, alpha, beta)\n",
      "     |      Weibull distribution.\n",
      "     |      \n",
      "     |      alpha is the scale parameter and beta is the shape parameter.\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Class methods defined here:\n",
      "     |  \n",
      "     |  __init_subclass__(**kwargs) from builtins.type\n",
      "     |      Control how subclasses generate random integers.\n",
      "     |      \n",
      "     |      The algorithm a subclass can use depends on the random() and/or\n",
      "     |      getrandbits() implementation available to it and determines\n",
      "     |      whether it can generate random integers from arbitrarily large\n",
      "     |      ranges.\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Data descriptors defined here:\n",
      "     |  \n",
      "     |  __dict__\n",
      "     |      dictionary for instance variables (if defined)\n",
      "     |  \n",
      "     |  __weakref__\n",
      "     |      list of weak references to the object (if defined)\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Data and other attributes defined here:\n",
      "     |  \n",
      "     |  VERSION = 3\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Methods inherited from _random.Random:\n",
      "     |  \n",
      "     |  getrandbits(self, k, /)\n",
      "     |      getrandbits(k) -> x.  Generates an int with k random bits.\n",
      "     |  \n",
      "     |  random(self, /)\n",
      "     |      random() -> x in the interval [0, 1).\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Static methods inherited from _random.Random:\n",
      "     |  \n",
      "     |  __new__(*args, **kwargs) from builtins.type\n",
      "     |      Create and return a new object.  See help(type) for accurate signature.\n",
      "    \n",
      "    class SystemRandom(Random)\n",
      "     |  SystemRandom(x=None)\n",
      "     |  \n",
      "     |  Alternate random number generator using sources provided\n",
      "     |  by the operating system (such as /dev/urandom on Unix or\n",
      "     |  CryptGenRandom on Windows).\n",
      "     |  \n",
      "     |   Not available on all systems (see os.urandom() for details).\n",
      "     |  \n",
      "     |  Method resolution order:\n",
      "     |      SystemRandom\n",
      "     |      Random\n",
      "     |      _random.Random\n",
      "     |      builtins.object\n",
      "     |  \n",
      "     |  Methods defined here:\n",
      "     |  \n",
      "     |  getrandbits(self, k)\n",
      "     |      getrandbits(k) -> x.  Generates an int with k random bits.\n",
      "     |  \n",
      "     |  getstate = _notimplemented(self, *args, **kwds)\n",
      "     |  \n",
      "     |  randbytes(self, n)\n",
      "     |      Generate n random bytes.\n",
      "     |  \n",
      "     |  random(self)\n",
      "     |      Get the next random number in the range [0.0, 1.0).\n",
      "     |  \n",
      "     |  seed(self, *args, **kwds)\n",
      "     |      Stub method.  Not used for a system random number generator.\n",
      "     |  \n",
      "     |  setstate = _notimplemented(self, *args, **kwds)\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Methods inherited from Random:\n",
      "     |  \n",
      "     |  __getstate__(self)\n",
      "     |      # Issue 17489: Since __reduce__ was defined to fix #759889 this is no\n",
      "     |      # longer called; we leave it here because it has been here since random was\n",
      "     |      # rewritten back in 2001 and why risk breaking something.\n",
      "     |  \n",
      "     |  __init__(self, x=None)\n",
      "     |      Initialize an instance.\n",
      "     |      \n",
      "     |      Optional argument x controls seeding, as for Random.seed().\n",
      "     |  \n",
      "     |  __reduce__(self)\n",
      "     |      Helper for pickle.\n",
      "     |  \n",
      "     |  __setstate__(self, state)\n",
      "     |  \n",
      "     |  betavariate(self, alpha, beta)\n",
      "     |      Beta distribution.\n",
      "     |      \n",
      "     |      Conditions on the parameters are alpha > 0 and beta > 0.\n",
      "     |      Returned values range between 0 and 1.\n",
      "     |  \n",
      "     |  choice(self, seq)\n",
      "     |      Choose a random element from a non-empty sequence.\n",
      "     |  \n",
      "     |  choices(self, population, weights=None, *, cum_weights=None, k=1)\n",
      "     |      Return a k sized list of population elements chosen with replacement.\n",
      "     |      \n",
      "     |      If the relative weights or cumulative weights are not specified,\n",
      "     |      the selections are made with equal probability.\n",
      "     |  \n",
      "     |  expovariate(self, lambd)\n",
      "     |      Exponential distribution.\n",
      "     |      \n",
      "     |      lambd is 1.0 divided by the desired mean.  It should be\n",
      "     |      nonzero.  (The parameter would be called \"lambda\", but that is\n",
      "     |      a reserved word in Python.)  Returned values range from 0 to\n",
      "     |      positive infinity if lambd is positive, and from negative\n",
      "     |      infinity to 0 if lambd is negative.\n",
      "     |  \n",
      "     |  gammavariate(self, alpha, beta)\n",
      "     |      Gamma distribution.  Not the gamma function!\n",
      "     |      \n",
      "     |      Conditions on the parameters are alpha > 0 and beta > 0.\n",
      "     |      \n",
      "     |      The probability distribution function is:\n",
      "     |      \n",
      "     |                  x ** (alpha - 1) * math.exp(-x / beta)\n",
      "     |        pdf(x) =  --------------------------------------\n",
      "     |                    math.gamma(alpha) * beta ** alpha\n",
      "     |  \n",
      "     |  gauss(self, mu, sigma)\n",
      "     |      Gaussian distribution.\n",
      "     |      \n",
      "     |      mu is the mean, and sigma is the standard deviation.  This is\n",
      "     |      slightly faster than the normalvariate() function.\n",
      "     |      \n",
      "     |      Not thread-safe without a lock around calls.\n",
      "     |  \n",
      "     |  lognormvariate(self, mu, sigma)\n",
      "     |      Log normal distribution.\n",
      "     |      \n",
      "     |      If you take the natural logarithm of this distribution, you'll get a\n",
      "     |      normal distribution with mean mu and standard deviation sigma.\n",
      "     |      mu can have any value, and sigma must be greater than zero.\n",
      "     |  \n",
      "     |  normalvariate(self, mu, sigma)\n",
      "     |      Normal distribution.\n",
      "     |      \n",
      "     |      mu is the mean, and sigma is the standard deviation.\n",
      "     |  \n",
      "     |  paretovariate(self, alpha)\n",
      "     |      Pareto distribution.  alpha is the shape parameter.\n",
      "     |  \n",
      "     |  randint(self, a, b)\n",
      "     |      Return random integer in range [a, b], including both end points.\n",
      "     |  \n",
      "     |  randrange(self, start, stop=None, step=1)\n",
      "     |      Choose a random item from range(start, stop[, step]).\n",
      "     |      \n",
      "     |      This fixes the problem with randint() which includes the\n",
      "     |      endpoint; in Python this is usually not what you want.\n",
      "     |  \n",
      "     |  sample(self, population, k, *, counts=None)\n",
      "     |      Chooses k unique random elements from a population sequence or set.\n",
      "     |      \n",
      "     |      Returns a new list containing elements from the population while\n",
      "     |      leaving the original population unchanged.  The resulting list is\n",
      "     |      in selection order so that all sub-slices will also be valid random\n",
      "     |      samples.  This allows raffle winners (the sample) to be partitioned\n",
      "     |      into grand prize and second place winners (the subslices).\n",
      "     |      \n",
      "     |      Members of the population need not be hashable or unique.  If the\n",
      "     |      population contains repeats, then each occurrence is a possible\n",
      "     |      selection in the sample.\n",
      "     |      \n",
      "     |      Repeated elements can be specified one at a time or with the optional\n",
      "     |      counts parameter.  For example:\n",
      "     |      \n",
      "     |          sample(['red', 'blue'], counts=[4, 2], k=5)\n",
      "     |      \n",
      "     |      is equivalent to:\n",
      "     |      \n",
      "     |          sample(['red', 'red', 'red', 'red', 'blue', 'blue'], k=5)\n",
      "     |      \n",
      "     |      To choose a sample from a range of integers, use range() for the\n",
      "     |      population argument.  This is especially fast and space efficient\n",
      "     |      for sampling from a large population:\n",
      "     |      \n",
      "     |          sample(range(10000000), 60)\n",
      "     |  \n",
      "     |  shuffle(self, x, random=None)\n",
      "     |      Shuffle list x in place, and return None.\n",
      "     |      \n",
      "     |      Optional argument random is a 0-argument function returning a\n",
      "     |      random float in [0.0, 1.0); if it is the default None, the\n",
      "     |      standard random.random will be used.\n",
      "     |  \n",
      "     |  triangular(self, low=0.0, high=1.0, mode=None)\n",
      "     |      Triangular distribution.\n",
      "     |      \n",
      "     |      Continuous distribution bounded by given lower and upper limits,\n",
      "     |      and having a given mode value in-between.\n",
      "     |      \n",
      "     |      http://en.wikipedia.org/wiki/Triangular_distribution\n",
      "     |  \n",
      "     |  uniform(self, a, b)\n",
      "     |      Get a random number in the range [a, b) or [a, b] depending on rounding.\n",
      "     |  \n",
      "     |  vonmisesvariate(self, mu, kappa)\n",
      "     |      Circular data distribution.\n",
      "     |      \n",
      "     |      mu is the mean angle, expressed in radians between 0 and 2*pi, and\n",
      "     |      kappa is the concentration parameter, which must be greater than or\n",
      "     |      equal to zero.  If kappa is equal to zero, this distribution reduces\n",
      "     |      to a uniform random angle over the range 0 to 2*pi.\n",
      "     |  \n",
      "     |  weibullvariate(self, alpha, beta)\n",
      "     |      Weibull distribution.\n",
      "     |      \n",
      "     |      alpha is the scale parameter and beta is the shape parameter.\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Class methods inherited from Random:\n",
      "     |  \n",
      "     |  __init_subclass__(**kwargs) from builtins.type\n",
      "     |      Control how subclasses generate random integers.\n",
      "     |      \n",
      "     |      The algorithm a subclass can use depends on the random() and/or\n",
      "     |      getrandbits() implementation available to it and determines\n",
      "     |      whether it can generate random integers from arbitrarily large\n",
      "     |      ranges.\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Data descriptors inherited from Random:\n",
      "     |  \n",
      "     |  __dict__\n",
      "     |      dictionary for instance variables (if defined)\n",
      "     |  \n",
      "     |  __weakref__\n",
      "     |      list of weak references to the object (if defined)\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Data and other attributes inherited from Random:\n",
      "     |  \n",
      "     |  VERSION = 3\n",
      "     |  \n",
      "     |  ----------------------------------------------------------------------\n",
      "     |  Static methods inherited from _random.Random:\n",
      "     |  \n",
      "     |  __new__(*args, **kwargs) from builtins.type\n",
      "     |      Create and return a new object.  See help(type) for accurate signature.\n",
      "\n",
      "FUNCTIONS\n",
      "    betavariate(alpha, beta) method of Random instance\n",
      "        Beta distribution.\n",
      "        \n",
      "        Conditions on the parameters are alpha > 0 and beta > 0.\n",
      "        Returned values range between 0 and 1.\n",
      "    \n",
      "    choice(seq) method of Random instance\n",
      "        Choose a random element from a non-empty sequence.\n",
      "    \n",
      "    choices(population, weights=None, *, cum_weights=None, k=1) method of Random instance\n",
      "        Return a k sized list of population elements chosen with replacement.\n",
      "        \n",
      "        If the relative weights or cumulative weights are not specified,\n",
      "        the selections are made with equal probability.\n",
      "    \n",
      "    expovariate(lambd) method of Random instance\n",
      "        Exponential distribution.\n",
      "        \n",
      "        lambd is 1.0 divided by the desired mean.  It should be\n",
      "        nonzero.  (The parameter would be called \"lambda\", but that is\n",
      "        a reserved word in Python.)  Returned values range from 0 to\n",
      "        positive infinity if lambd is positive, and from negative\n",
      "        infinity to 0 if lambd is negative.\n",
      "    \n",
      "    gammavariate(alpha, beta) method of Random instance\n",
      "        Gamma distribution.  Not the gamma function!\n",
      "        \n",
      "        Conditions on the parameters are alpha > 0 and beta > 0.\n",
      "        \n",
      "        The probability distribution function is:\n",
      "        \n",
      "                    x ** (alpha - 1) * math.exp(-x / beta)\n",
      "          pdf(x) =  --------------------------------------\n",
      "                      math.gamma(alpha) * beta ** alpha\n",
      "    \n",
      "    gauss(mu, sigma) method of Random instance\n",
      "        Gaussian distribution.\n",
      "        \n",
      "        mu is the mean, and sigma is the standard deviation.  This is\n",
      "        slightly faster than the normalvariate() function.\n",
      "        \n",
      "        Not thread-safe without a lock around calls.\n",
      "    \n",
      "    getrandbits(k, /) method of Random instance\n",
      "        getrandbits(k) -> x.  Generates an int with k random bits.\n",
      "    \n",
      "    getstate() method of Random instance\n",
      "        Return internal state; can be passed to setstate() later.\n",
      "    \n",
      "    lognormvariate(mu, sigma) method of Random instance\n",
      "        Log normal distribution.\n",
      "        \n",
      "        If you take the natural logarithm of this distribution, you'll get a\n",
      "        normal distribution with mean mu and standard deviation sigma.\n",
      "        mu can have any value, and sigma must be greater than zero.\n",
      "    \n",
      "    normalvariate(mu, sigma) method of Random instance\n",
      "        Normal distribution.\n",
      "        \n",
      "        mu is the mean, and sigma is the standard deviation.\n",
      "    \n",
      "    paretovariate(alpha) method of Random instance\n",
      "        Pareto distribution.  alpha is the shape parameter.\n",
      "    \n",
      "    randbytes(n) method of Random instance\n",
      "        Generate n random bytes.\n",
      "    \n",
      "    randint(a, b) method of Random instance\n",
      "        Return random integer in range [a, b], including both end points.\n",
      "    \n",
      "    random() method of Random instance\n",
      "        random() -> x in the interval [0, 1).\n",
      "    \n",
      "    randrange(start, stop=None, step=1) method of Random instance\n",
      "        Choose a random item from range(start, stop[, step]).\n",
      "        \n",
      "        This fixes the problem with randint() which includes the\n",
      "        endpoint; in Python this is usually not what you want.\n",
      "    \n",
      "    sample(population, k, *, counts=None) method of Random instance\n",
      "        Chooses k unique random elements from a population sequence or set.\n",
      "        \n",
      "        Returns a new list containing elements from the population while\n",
      "        leaving the original population unchanged.  The resulting list is\n",
      "        in selection order so that all sub-slices will also be valid random\n",
      "        samples.  This allows raffle winners (the sample) to be partitioned\n",
      "        into grand prize and second place winners (the subslices).\n",
      "        \n",
      "        Members of the population need not be hashable or unique.  If the\n",
      "        population contains repeats, then each occurrence is a possible\n",
      "        selection in the sample.\n",
      "        \n",
      "        Repeated elements can be specified one at a time or with the optional\n",
      "        counts parameter.  For example:\n",
      "        \n",
      "            sample(['red', 'blue'], counts=[4, 2], k=5)\n",
      "        \n",
      "        is equivalent to:\n",
      "        \n",
      "            sample(['red', 'red', 'red', 'red', 'blue', 'blue'], k=5)\n",
      "        \n",
      "        To choose a sample from a range of integers, use range() for the\n",
      "        population argument.  This is especially fast and space efficient\n",
      "        for sampling from a large population:\n",
      "        \n",
      "            sample(range(10000000), 60)\n",
      "    \n",
      "    seed(a=None, version=2) method of Random instance\n",
      "        Initialize internal state from a seed.\n",
      "        \n",
      "        The only supported seed types are None, int, float,\n",
      "        str, bytes, and bytearray.\n",
      "        \n",
      "        None or no argument seeds from current time or from an operating\n",
      "        system specific randomness source if available.\n",
      "        \n",
      "        If *a* is an int, all bits are used.\n",
      "        \n",
      "        For version 2 (the default), all of the bits are used if *a* is a str,\n",
      "        bytes, or bytearray.  For version 1 (provided for reproducing random\n",
      "        sequences from older versions of Python), the algorithm for str and\n",
      "        bytes generates a narrower range of seeds.\n",
      "    \n",
      "    setstate(state) method of Random instance\n",
      "        Restore internal state from object returned by getstate().\n",
      "    \n",
      "    shuffle(x, random=None) method of Random instance\n",
      "        Shuffle list x in place, and return None.\n",
      "        \n",
      "        Optional argument random is a 0-argument function returning a\n",
      "        random float in [0.0, 1.0); if it is the default None, the\n",
      "        standard random.random will be used.\n",
      "    \n",
      "    triangular(low=0.0, high=1.0, mode=None) method of Random instance\n",
      "        Triangular distribution.\n",
      "        \n",
      "        Continuous distribution bounded by given lower and upper limits,\n",
      "        and having a given mode value in-between.\n",
      "        \n",
      "        http://en.wikipedia.org/wiki/Triangular_distribution\n",
      "    \n",
      "    uniform(a, b) method of Random instance\n",
      "        Get a random number in the range [a, b) or [a, b] depending on rounding.\n",
      "    \n",
      "    vonmisesvariate(mu, kappa) method of Random instance\n",
      "        Circular data distribution.\n",
      "        \n",
      "        mu is the mean angle, expressed in radians between 0 and 2*pi, and\n",
      "        kappa is the concentration parameter, which must be greater than or\n",
      "        equal to zero.  If kappa is equal to zero, this distribution reduces\n",
      "        to a uniform random angle over the range 0 to 2*pi.\n",
      "    \n",
      "    weibullvariate(alpha, beta) method of Random instance\n",
      "        Weibull distribution.\n",
      "        \n",
      "        alpha is the scale parameter and beta is the shape parameter.\n",
      "\n",
      "DATA\n",
      "    __all__ = ['Random', 'SystemRandom', 'betavariate', 'choice', 'choices...\n",
      "\n",
      "FILE\n",
      "    /Users/ZhangBaoZhe/opt/anaconda3/lib/python3.9/random.py\n",
      "\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(random)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7cf69b7d",
   "metadata": {},
   "source": [
    "课本P35"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1991fb8d",
   "metadata": {},
   "outputs": [],
   "source": [
    "#help(random)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9a6af27f",
   "metadata": {},
   "outputs": [],
   "source": [
    "import detetime\n",
    "\n",
    "odds"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d7377c38",
   "metadata": {},
   "source": [
    " 课本43实践"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "01a48983",
   "metadata": {},
   "outputs": [],
   "source": [
    "word=\"bottles\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "id": "fe3c2b3d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "99 bottles of beer on the wall\n",
      "99 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "98 bottles of beer on the wall.\n",
      "\n",
      "98 bottles of beer on the wall\n",
      "98 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "97 bottles of beer on the wall.\n",
      "\n",
      "97 bottles of beer on the wall\n",
      "97 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "96 bottles of beer on the wall.\n",
      "\n",
      "96 bottles of beer on the wall\n",
      "96 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "95 bottles of beer on the wall.\n",
      "\n",
      "95 bottles of beer on the wall\n",
      "95 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "94 bottles of beer on the wall.\n",
      "\n",
      "94 bottles of beer on the wall\n",
      "94 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "93 bottles of beer on the wall.\n",
      "\n",
      "93 bottles of beer on the wall\n",
      "93 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "92 bottles of beer on the wall.\n",
      "\n",
      "92 bottles of beer on the wall\n",
      "92 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "91 bottles of beer on the wall.\n",
      "\n",
      "91 bottles of beer on the wall\n",
      "91 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "90 bottles of beer on the wall.\n",
      "\n",
      "90 bottles of beer on the wall\n",
      "90 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "89 bottles of beer on the wall.\n",
      "\n",
      "89 bottles of beer on the wall\n",
      "89 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "88 bottles of beer on the wall.\n",
      "\n",
      "88 bottles of beer on the wall\n",
      "88 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "87 bottles of beer on the wall.\n",
      "\n",
      "87 bottles of beer on the wall\n",
      "87 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "86 bottles of beer on the wall.\n",
      "\n",
      "86 bottles of beer on the wall\n",
      "86 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "85 bottles of beer on the wall.\n",
      "\n",
      "85 bottles of beer on the wall\n",
      "85 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "84 bottles of beer on the wall.\n",
      "\n",
      "84 bottles of beer on the wall\n",
      "84 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "83 bottles of beer on the wall.\n",
      "\n",
      "83 bottles of beer on the wall\n",
      "83 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "82 bottles of beer on the wall.\n",
      "\n",
      "82 bottles of beer on the wall\n",
      "82 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "81 bottles of beer on the wall.\n",
      "\n",
      "81 bottles of beer on the wall\n",
      "81 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "80 bottles of beer on the wall.\n",
      "\n",
      "80 bottles of beer on the wall\n",
      "80 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "79 bottles of beer on the wall.\n",
      "\n",
      "79 bottles of beer on the wall\n",
      "79 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "78 bottles of beer on the wall.\n",
      "\n",
      "78 bottles of beer on the wall\n",
      "78 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "77 bottles of beer on the wall.\n",
      "\n",
      "77 bottles of beer on the wall\n",
      "77 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "76 bottles of beer on the wall.\n",
      "\n",
      "76 bottles of beer on the wall\n",
      "76 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "75 bottles of beer on the wall.\n",
      "\n",
      "75 bottles of beer on the wall\n",
      "75 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "74 bottles of beer on the wall.\n",
      "\n",
      "74 bottles of beer on the wall\n",
      "74 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "73 bottles of beer on the wall.\n",
      "\n",
      "73 bottles of beer on the wall\n",
      "73 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "72 bottles of beer on the wall.\n",
      "\n",
      "72 bottles of beer on the wall\n",
      "72 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "71 bottles of beer on the wall.\n",
      "\n",
      "71 bottles of beer on the wall\n",
      "71 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "70 bottles of beer on the wall.\n",
      "\n",
      "70 bottles of beer on the wall\n",
      "70 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "69 bottles of beer on the wall.\n",
      "\n",
      "69 bottles of beer on the wall\n",
      "69 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "68 bottles of beer on the wall.\n",
      "\n",
      "68 bottles of beer on the wall\n",
      "68 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "67 bottles of beer on the wall.\n",
      "\n",
      "67 bottles of beer on the wall\n",
      "67 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "66 bottles of beer on the wall.\n",
      "\n",
      "66 bottles of beer on the wall\n",
      "66 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "65 bottles of beer on the wall.\n",
      "\n",
      "65 bottles of beer on the wall\n",
      "65 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "64 bottles of beer on the wall.\n",
      "\n",
      "64 bottles of beer on the wall\n",
      "64 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "63 bottles of beer on the wall.\n",
      "\n",
      "63 bottles of beer on the wall\n",
      "63 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "62 bottles of beer on the wall.\n",
      "\n",
      "62 bottles of beer on the wall\n",
      "62 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "61 bottles of beer on the wall.\n",
      "\n",
      "61 bottles of beer on the wall\n",
      "61 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "60 bottles of beer on the wall.\n",
      "\n",
      "60 bottles of beer on the wall\n",
      "60 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "59 bottles of beer on the wall.\n",
      "\n",
      "59 bottles of beer on the wall\n",
      "59 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "58 bottles of beer on the wall.\n",
      "\n",
      "58 bottles of beer on the wall\n",
      "58 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "57 bottles of beer on the wall.\n",
      "\n",
      "57 bottles of beer on the wall\n",
      "57 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "56 bottles of beer on the wall.\n",
      "\n",
      "56 bottles of beer on the wall\n",
      "56 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "55 bottles of beer on the wall.\n",
      "\n",
      "55 bottles of beer on the wall\n",
      "55 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "54 bottles of beer on the wall.\n",
      "\n",
      "54 bottles of beer on the wall\n",
      "54 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "53 bottles of beer on the wall.\n",
      "\n",
      "53 bottles of beer on the wall\n",
      "53 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "52 bottles of beer on the wall.\n",
      "\n",
      "52 bottles of beer on the wall\n",
      "52 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "51 bottles of beer on the wall.\n",
      "\n",
      "51 bottles of beer on the wall\n",
      "51 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "50 bottles of beer on the wall.\n",
      "\n",
      "50 bottles of beer on the wall\n",
      "50 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "49 bottles of beer on the wall.\n",
      "\n",
      "49 bottles of beer on the wall\n",
      "49 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "48 bottles of beer on the wall.\n",
      "\n",
      "48 bottles of beer on the wall\n",
      "48 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "47 bottles of beer on the wall.\n",
      "\n",
      "47 bottles of beer on the wall\n",
      "47 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "46 bottles of beer on the wall.\n",
      "\n",
      "46 bottles of beer on the wall\n",
      "46 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "45 bottles of beer on the wall.\n",
      "\n",
      "45 bottles of beer on the wall\n",
      "45 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "44 bottles of beer on the wall.\n",
      "\n",
      "44 bottles of beer on the wall\n",
      "44 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "43 bottles of beer on the wall.\n",
      "\n",
      "43 bottles of beer on the wall\n",
      "43 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "42 bottles of beer on the wall.\n",
      "\n",
      "42 bottles of beer on the wall\n",
      "42 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "41 bottles of beer on the wall.\n",
      "\n",
      "41 bottles of beer on the wall\n",
      "41 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "40 bottles of beer on the wall.\n",
      "\n",
      "40 bottles of beer on the wall\n",
      "40 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "39 bottles of beer on the wall.\n",
      "\n",
      "39 bottles of beer on the wall\n",
      "39 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "38 bottles of beer on the wall.\n",
      "\n",
      "38 bottles of beer on the wall\n",
      "38 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "37 bottles of beer on the wall.\n",
      "\n",
      "37 bottles of beer on the wall\n",
      "37 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "36 bottles of beer on the wall.\n",
      "\n",
      "36 bottles of beer on the wall\n",
      "36 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "35 bottles of beer on the wall.\n",
      "\n",
      "35 bottles of beer on the wall\n",
      "35 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "34 bottles of beer on the wall.\n",
      "\n",
      "34 bottles of beer on the wall\n",
      "34 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "33 bottles of beer on the wall.\n",
      "\n",
      "33 bottles of beer on the wall\n",
      "33 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "32 bottles of beer on the wall.\n",
      "\n",
      "32 bottles of beer on the wall\n",
      "32 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "31 bottles of beer on the wall.\n",
      "\n",
      "31 bottles of beer on the wall\n",
      "31 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "30 bottles of beer on the wall.\n",
      "\n",
      "30 bottles of beer on the wall\n",
      "30 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "29 bottles of beer on the wall.\n",
      "\n",
      "29 bottles of beer on the wall\n",
      "29 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "28 bottles of beer on the wall.\n",
      "\n",
      "28 bottles of beer on the wall\n",
      "28 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "27 bottles of beer on the wall.\n",
      "\n",
      "27 bottles of beer on the wall\n",
      "27 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "26 bottles of beer on the wall.\n",
      "\n",
      "26 bottles of beer on the wall\n",
      "26 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "25 bottles of beer on the wall.\n",
      "\n",
      "25 bottles of beer on the wall\n",
      "25 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "24 bottles of beer on the wall.\n",
      "\n",
      "24 bottles of beer on the wall\n",
      "24 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "23 bottles of beer on the wall.\n",
      "\n",
      "23 bottles of beer on the wall\n",
      "23 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "22 bottles of beer on the wall.\n",
      "\n",
      "22 bottles of beer on the wall\n",
      "22 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "21 bottles of beer on the wall.\n",
      "\n",
      "21 bottles of beer on the wall\n",
      "21 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "20 bottles of beer on the wall.\n",
      "\n",
      "20 bottles of beer on the wall\n",
      "20 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "19 bottles of beer on the wall.\n",
      "\n",
      "19 bottles of beer on the wall\n",
      "19 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "18 bottles of beer on the wall.\n",
      "\n",
      "18 bottles of beer on the wall\n",
      "18 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "17 bottles of beer on the wall.\n",
      "\n",
      "17 bottles of beer on the wall\n",
      "17 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "16 bottles of beer on the wall.\n",
      "\n",
      "16 bottles of beer on the wall\n",
      "16 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "15 bottles of beer on the wall.\n",
      "\n",
      "15 bottles of beer on the wall\n",
      "15 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "14 bottles of beer on the wall.\n",
      "\n",
      "14 bottles of beer on the wall\n",
      "14 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "13 bottles of beer on the wall.\n",
      "\n",
      "13 bottles of beer on the wall\n",
      "13 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "12 bottles of beer on the wall.\n",
      "\n",
      "12 bottles of beer on the wall\n",
      "12 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "11 bottles of beer on the wall.\n",
      "\n",
      "11 bottles of beer on the wall\n",
      "11 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "10 bottles of beer on the wall.\n",
      "\n",
      "10 bottles of beer on the wall\n",
      "10 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "9 bottles of beer on the wall.\n",
      "\n",
      "9 bottles of beer on the wall\n",
      "9 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "8 bottles of beer on the wall.\n",
      "\n",
      "8 bottles of beer on the wall\n",
      "8 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "7 bottles of beer on the wall.\n",
      "\n",
      "7 bottles of beer on the wall\n",
      "7 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "6 bottles of beer on the wall.\n",
      "\n",
      "6 bottles of beer on the wall\n",
      "6 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "5 bottles of beer on the wall.\n",
      "\n",
      "5 bottles of beer on the wall\n",
      "5 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "4 bottles of beer on the wall.\n",
      "\n",
      "4 bottles of beer on the wall\n",
      "4 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "3 bottles of beer on the wall.\n",
      "\n",
      "3 bottles of beer on the wall\n",
      "3 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "2 bottles of beer on the wall.\n",
      "\n",
      "2 bottles of beer on the wall\n",
      "2 bottles of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "1 bottle of beer on the wall.\n",
      "\n",
      "1 bottle of beer on the wall\n",
      "1 bottle of beer\n",
      "Take one dowm\n",
      "Pass it around.\n",
      "No more bottles of beer of beer on the wall\n",
      "1 bottle of beer on the wall.\n",
      "\n"
     ]
    }
   ],
   "source": [
    "word=\"bottles\"\n",
    "\n",
    "for beer_num in range(99,0,-1):\n",
    "    print(beer_num,word,\"of beer on the wall\")\n",
    "    print(beer_num,word,\"of beer\")\n",
    "    print(\"Take one dowm\")\n",
    "    print(\"Pass it around.\")\n",
    "    if beer_num == 1:\n",
    "       print(\"No more bottles of beer of beer on the wall\") \n",
    "    else:\n",
    "        new_num=beer_num - 1\n",
    "        if new_num == 1:\n",
    "            word = \"bottle\"\n",
    "    print(new_num,word,\"of beer on the wall.\")\n",
    "    print()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "812a0ba2",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ae8fa90d",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
